package Ecu911_Datos;

/**
 *
 * @author Marcelo Montaño
 */
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import org.postgresql.util.PSQLException;

public class OperacionesBaseDatos {
     ManejadorBaseDatos db = new ManejadorBaseDatos();

	public boolean ingreso (String query) throws SQLException, PSQLException
	{		
		Connection var= db.getConnection();
		Statement stmt = var.createStatement();
		boolean resultado=stmt.execute(query);
		var.commit();
		return resultado;
	}
	 
	public ResultSet seleccion (String query) throws SQLException
	{		
		Connection var= db.getConnection();
		Statement stmt = var.createStatement();
		ResultSet resultado=stmt.executeQuery(query);
		return resultado;
	}
	 public int modificacioneliminacion (String query) throws SQLException
	{		
		Connection var= db.getConnection();
		Statement stmt = var.createStatement();
		int resultado=stmt.executeUpdate(query);
                var.commit();
		return resultado;
	}
	 
	public void cerrarConexion() throws SQLException{
                db.getConnection().close();
	}
}
